Dyr og Data

Infographics

Gavin Simpson

Aarhus University

Mona Larsen

Aarhus University

2024-11-19

Infographics

Infographic are graphic visual representations of information, data, or knowledge intended to present information quickly and clearly

Infographics have evolved in recent years to be for mass communication

Are designed with fewer assumptions about the readers’ knowledge base than other types of visualizations

Examples

Examples

Examples

Examples

Consider your audience

To whom are you communicating?

Different kinds of graphics will be needed depending on who your intended audience is

Consider the audience’s level of data / statistical sophistication

Produce infographic

library("palmerpenguins")
library("ggplot2")
library("showtext")
library("marquee")
library("patchwork")
library("magick")

Google fonts

https://fonts.google.com/

Lots of fonts that you can download for use in graphics

Importing fonts

# name of google font, name it will be known as in R
font_add_google("Pacifico", "pacifico")

# use showtext to render text
showtext_auto()

Plot

penguins |>
  ggplot(
    aes(
      x = flipper_length_mm, y = body_mass_g,
      colour = species
    )
  ) +
  geom_point() +
  labs(
    title = "Penguins, eh?"
  ) +
  theme_minimal() +
  theme(
    title = element_text(family = "pacifico")
  )

Plot

build your plot up

penguins |>
  ggplot(
    aes(
      x = flipper_length_mm, y = body_mass_g,
      colour = species
    )
  ) +
  geom_point() +
  theme_minimal() +
  theme(
    title = element_text(family = "pacifico")
  ) -> plt

build your plot up

penguin_cols <- c("darkorange", "purple", 
  "cyan4")
plt <- plt +
  scale_colour_manual(
    values = penguin_cols
  )
plt

Build your plot up

plt +
  labs(
    title = "Penguins, eh? Bigger than you thought!",
    subtitle = "This scatterplot shows the relationship between the length of a penguin's flipper and it's body mass\nfor three different species of penguin; Adelie, Chinstrap, & Gentoo",
    x = "Length of their bill in mm",
    y = "Depth of their bill in mm"
  )

Fine tune

It would be nice if we could get rid of the legend

Colour the species name in the subtitle — marquee

marquee

With marquee, we specify the colour, say, using

"{.red Text to appear goes here}"
[1] "{.red Text to appear goes here}"

But we want to mix plain text & coloured text, and perhaps use computed info — marquee_glue()

red_text <- "this text will be red"
marquee_glue("This will be black and {.red {red_text}}!")
This will be black and {.red this text will be red}!

cols <- penguin_cols
names(cols) <- c("Adelie", "Chinstrap", "Gentoo")

st <- "This scatterplot shows the relationship between the length of a penguin's flipper and it's body mass\nfor three different species of penguin; {.{cols['Adelie']} Adelie}, {.{cols['Chinstrap']} Chinstrap}, & {.{cols['Gentoo']} Gentoo}"

mq_st <- marquee_glue(st)

plt +
  labs(
    title = "Penguins, eh? Bigger than you thought!",
    subtitle = mq_st,
    x = "Length of their flipper in mm",
    y = "Body mass in grammes"
  ) +
  theme(
    legend.position = "none",
    plot.subtitle = element_marquee(width = 1, family = "pacifico")
  ) -> final_plt
final_plt

Multiple panels

p_img <- image_read("assets/penguins.png")
p_plt <- image_ggplot(p_img)

bill_img <- image_read("assets/culmen_depth.png")
bill_plt <- image_ggplot(bill_img)

Creating the layout

layout <- "
AACCC
BBCCC
"

p_plt + bill_plt + final_plt + plot_layout(design = layout)

Creating the layout

Things you can do

  1. Use themes
  2. Use colours
    • either the background of the plot or,
    • for the features on the plot
  3. Include images
  4. Include text (ggplot2::annotate())
  5. Combine components with patchwork
  6. Include a table
  7. Use different fonts